package com.fwmagic.spark.core.action

import org.apache.spark.{SparkConf, SparkContext}

/**
  * 返回数据集的元素个数
  */
object CountDemo {
    def main(args: Array[String]): Unit = {
        val conf = new SparkConf()
                .setAppName(this.getClass.getSimpleName)
                .setMaster("local[*]")

        val sc = new SparkContext(conf)

        val rdd1 = sc.makeRDD(1 to 10)

        val count: Long = rdd1.count()

        println(count)

        sc.stop()
    }
}
